package com.example.xunai.dto.response.ai;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ChatResponse {
    private String content;
    private Long conversationId;
    private String sessionId;
    private String modelType;
    private Integer tokenUsage;
    private LocalDateTime responseTime;
    private Boolean isStreaming;
    private String requestId;

    public static ChatResponse of(String content, Long conversationId, String modelType) {
        return ChatResponse.builder()
                .content(content)
                .conversationId(conversationId)
                .modelType(modelType)
                .responseTime(LocalDateTime.now())
                .isStreaming(false)
                .build();
    }

    public static ChatResponse of(String content, Long conversationId, String modelType, Integer tokenUsage) {
        return ChatResponse.builder()
                .content(content)
                .conversationId(conversationId)
                .modelType(modelType)
                .tokenUsage(tokenUsage)
                .responseTime(LocalDateTime.now())
                .isStreaming(false)
                .build();
    }

    public static ChatResponse streaming(Long conversationId, String sessionId, String modelType) {
        return ChatResponse.builder()
                .conversationId(conversationId)
                .sessionId(sessionId)
                .modelType(modelType)
                .responseTime(LocalDateTime.now())
                .isStreaming(true)
                .build();
    }
}